library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library("ggplot2")
## Warning: package 'ggplot2' was built under R version 4.1.2
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.1.2
#importing the data sets
athletes <- read.csv("athlete_events.csv")
nrow(athletes)
## [1] 271116
region <- read.csv("noc_regions.csv")
nrow(region)
## [1] 230
head(athletes)
head(region)
#Combining the two data frames
athletes_df <- merge(x = athletes, y = region, by = 'NOC')
#Renaming columns region to Region, notes to Notes
colnames(athletes_df)[16] <- "Region"
colnames(athletes_df)[17] <- "Notes"
#Displaying details of columns
summary(athletes_df)
##      NOC                  ID             Name               Sex           
##  Length:270767      Min.   :     1   Length:270767      Length:270767     
##  Class :character   1st Qu.: 34631   Class :character   Class :character  
##  Mode  :character   Median : 68187   Mode  :character   Mode  :character  
##                     Mean   : 68229                                        
##                     3rd Qu.:102066                                        
##                     Max.   :135571                                        
##                                                                           
##       Age            Height          Weight           Team          
##  Min.   :10.00   Min.   :127.0   Min.   : 25.00   Length:270767     
##  1st Qu.:21.00   1st Qu.:168.0   1st Qu.: 60.00   Class :character  
##  Median :24.00   Median :175.0   Median : 70.00   Mode  :character  
##  Mean   :25.56   Mean   :175.3   Mean   : 70.71                     
##  3rd Qu.:28.00   3rd Qu.:183.0   3rd Qu.: 79.00                     
##  Max.   :97.00   Max.   :226.0   Max.   :214.00                     
##  NA's   :9462    NA's   :60083   NA's   :62785                      
##     Games                Year         Season              City          
##  Length:270767      Min.   :1896   Length:270767      Length:270767     
##  Class :character   1st Qu.:1960   Class :character   Class :character  
##  Mode  :character   Median :1988   Mode  :character   Mode  :character  
##                     Mean   :1978                                        
##                     3rd Qu.:2002                                        
##                     Max.   :2016                                        
##                                                                         
##     Sport              Event              Medal              Region         
##  Length:270767      Length:270767      Length:270767      Length:270767     
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##     Notes          
##  Length:270767     
##  Class :character  
##  Mode  :character  
##                    
##                    
##                    
## 
#Identifying the columns with NAs
NA_col <- colnames(athletes_df)[apply(athletes_df, 2, anyNA)]
NA_col
## [1] "Age"    "Height" "Weight" "Medal"  "Region"
sum(is.na(athletes_df$Age))
## [1] 9462
#Check no. of NAs in each column
sapply(athletes_df, function(x) sum(is.na(x)))
##    NOC     ID   Name    Sex    Age Height Weight   Team  Games   Year Season 
##      0      0      0      0   9462  60083  62785      0      0      0      0 
##   City  Sport  Event  Medal Region  Notes 
##      0      0      0 230993     21      0
unique(athletes_df$Age)
##  [1] NA 28 24 34 20 25 23 22 21 27 19 17 31 26 29 30 18 35 47 32 55 51 16 41 33
## [26] 39 37 15 40 36 43 44 46 14 38 45 49 61 13 58 42 54 57 53 48 60 52 56 50 62
## [51] 59 64 65 69 72 63 68 76 70 67 12 74 73 66 81 11 71 75 84 80 10 97 88 77 96
max(athletes_df$Age, na.rm = TRUE)
## [1] 97
#athletes_df$Medal == "Gold"
head(athletes_df[athletes_df$Medal == "Gold",])
# Dropping entire NAs will reduce data size
athletes_temp_df <- athletes_df %>% drop_na()
#dim(athletes_temp_df)
#Assign “NA” string to non available data
athletes_df$Medal[is.na(athletes_df$Medal)] <- "NA"
athletes_df$Age[is.na(athletes_df$Age)] <- 0
#Plotting the ages of athletes

hist(athletes_df$Age, xlab = "Age", ylab = "Frequency of Age", xlim = c(0,80), col = "blue", las =1, border = "green", main = "Histogram of Athletes Age")

# Unique items
unique(athletes_df$Games)
##  [1] "1956 Summer" "1948 Summer" "1980 Summer" "1964 Summer" "1960 Summer"
##  [6] "1936 Summer" "1972 Summer" "1968 Summer" "2016 Summer" "1988 Summer"
## [11] "2004 Summer" "2008 Summer" "1996 Summer" "2012 Summer" "1984 Summer"
## [16] "1952 Summer" "2000 Summer" "1988 Winter" "1976 Summer" "1992 Winter"
## [21] "1992 Summer" "2006 Winter" "2010 Winter" "2014 Winter" "1998 Winter"
## [26] "1976 Winter" "1994 Winter" "1980 Winter" "2002 Winter" "1984 Winter"
## [31] "1912 Summer" "1908 Summer" "1964 Winter" "1932 Summer" "1924 Summer"
## [36] "1928 Summer" "1928 Winter" "1960 Winter" "1948 Winter" "1972 Winter"
## [41] "1968 Winter" "1952 Winter" "1900 Summer" "1920 Summer" "1906 Summer"
## [46] "1956 Winter" "1924 Winter" "1936 Winter" "1904 Summer" "1896 Summer"
## [51] "1932 Winter"
# Unique items

unique(athletes_df$Sport)
##  [1] "Hockey"                    "Wrestling"                
##  [3] "Football"                  "Athletics"                
##  [5] "Boxing"                    "Taekwondo"                
##  [7] "Judo"                      "Weightlifting"            
##  [9] "Shooting"                  "Triathlon"                
## [11] "Synchronized Swimming"     "Sailing"                  
## [13] "Swimming"                  "Equestrianism"            
## [15] "Bobsleigh"                 "Fencing"                  
## [17] "Luge"                      "Alpine Skiing"            
## [19] "Cycling"                   "Gymnastics"               
## [21] "Cross Country Skiing"      "Rowing"                   
## [23] "Handball"                  "Volleyball"               
## [25] "Table Tennis"              "Trampolining"             
## [27] "Badminton"                 "Tennis"                   
## [29] "Canoeing"                  "Snowboarding"             
## [31] "Biathlon"                  "Basketball"               
## [33] "Beach Volleyball"          "Rugby"                    
## [35] "Diving"                    "Rugby Sevens"             
## [37] "Water Polo"                "Polo"                     
## [39] "Art Competitions"          "Skeleton"                 
## [41] "Freestyle Skiing"          "Modern Pentathlon"        
## [43] "Figure Skating"            "Archery"                  
## [45] "Golf"                      "Softball"                 
## [47] "Baseball"                  "Speed Skating"            
## [49] "Short Track Speed Skating" "Rhythmic Gymnastics"      
## [51] "Ice Hockey"                "Alpinism"                 
## [53] "Nordic Combined"           "Ski Jumping"              
## [55] "Tug-Of-War"                "Lacrosse"                 
## [57] "Curling"                   "Basque Pelota"            
## [59] "Military Ski Patrol"       "Croquet"                  
## [61] "Motorboating"              "Cricket"                  
## [63] "Racquets"                  "Jeu De Paume"             
## [65] "Aeronautics"               "Roque"
# Unique items

unique(athletes_df$Event)
##   [1] "Hockey Men's Hockey"                                                                  
##   [2] "Wrestling Men's Bantamweight, Freestyle"                                              
##   [3] "Wrestling Men's Welterweight, Freestyle"                                              
##   [4] "Wrestling Men's Bantamweight, Greco-Roman"                                            
##   [5] "Wrestling Men's Heavyweight, Freestyle"                                               
##   [6] "Football Men's Football"                                                              
##   [7] "Athletics Men's 100 metres"                                                           
##   [8] "Athletics Men's Long Jump"                                                            
##   [9] "Athletics Men's 400 metres"                                                           
##  [10] "Wrestling Men's Lightweight, Freestyle"                                               
##  [11] "Wrestling Men's Flyweight, Freestyle"                                                 
##  [12] "Wrestling Men's Featherweight, Greco-Roman"                                           
##  [13] "Boxing Men's Lightweight"                                                             
##  [14] "Wrestling Men's Light-Heavyweight, Freestyle"                                         
##  [15] "Wrestling Men's Middleweight, Freestyle"                                              
##  [16] "Wrestling Men's Featherweight, Freestyle"                                             
##  [17] "Wrestling Men's Light-Flyweight, Freestyle"                                           
##  [18] "Athletics Men's 4 x 100 metres Relay"                                                 
##  [19] "Boxing Men's Featherweight"                                                           
##  [20] "Wrestling Men's Lightweight, Greco-Roman"                                             
##  [21] "Taekwondo Men's Flyweight"                                                            
##  [22] "Boxing Men's Bantamweight"                                                            
##  [23] "Athletics Men's Shot Put"                                                             
##  [24] "Athletics Men's Marathon"                                                             
##  [25] "Athletics Women's 100 metres"                                                         
##  [26] "Boxing Men's Flyweight"                                                               
##  [27] "Athletics Men's 200 metres"                                                           
##  [28] "Taekwondo Men's Featherweight"                                                        
##  [29] "Boxing Men's Welterweight"                                                            
##  [30] "Judo Women's Middleweight"                                                            
##  [31] "Athletics Men's Javelin Throw"                                                        
##  [32] "Athletics Men's 110 metres Hurdles"                                                   
##  [33] "Judo Men's Half-Lightweight"                                                          
##  [34] "Judo Men's Half-Heavyweight"                                                          
##  [35] "Taekwondo Men's Welterweight"                                                         
##  [36] "Weightlifting Men's Bantamweight"                                                     
##  [37] "Shooting Mixed Small-Bore Rifle, Prone, 50 metres"                                    
##  [38] "Triathlon Men's Olympic Distance"                                                     
##  [39] "Weightlifting Men's Heavyweight"                                                      
##  [40] "Weightlifting Men's Middleweight"                                                     
##  [41] "Synchronized Swimming Women's Duet"                                                   
##  [42] "Sailing Mixed Windsurfer"                                                             
##  [43] "Swimming Men's 50 metres Freestyle"                                                   
##  [44] "Equestrianism Mixed Three-Day Event, Individual"                                      
##  [45] "Judo Men's Middleweight"                                                              
##  [46] "Bobsleigh Men's Two"                                                                  
##  [47] "Swimming Men's 100 metres Freestyle"                                                  
##  [48] "Swimming Women's 100 metres Backstroke"                                               
##  [49] "Sailing Men's Windsurfer"                                                             
##  [50] "Athletics Women's 200 metres"                                                         
##  [51] "Weightlifting Men's Light-Heavyweight"                                                
##  [52] "Shooting Women's Air Rifle, 10 metres"                                                
##  [53] "Judo Men's Heavyweight"                                                               
##  [54] "Weightlifting Men's Middle-Heavyweight"                                               
##  [55] "Shooting Men's Trap"                                                                  
##  [56] "Sailing Women's Windsurfer"                                                           
##  [57] "Weightlifting Men's Lightweight"                                                      
##  [58] "Synchronized Swimming Women's Solo"                                                   
##  [59] "Athletics Women's 800 metres"                                                         
##  [60] "Sailing Mixed One Person Dinghy"                                                      
##  [61] "Shooting Men's Double Trap"                                                           
##  [62] "Fencing Men's Sabre, Individual"                                                      
##  [63] "Swimming Men's 200 metres Freestyle"                                                  
##  [64] "Luge Men's Singles"                                                                   
##  [65] "Swimming Men's 400 metres Freestyle"                                                  
##  [66] "Shooting Men's Air Pistol, 10 metres"                                                 
##  [67] "Fencing Women's Foil, Individual"                                                     
##  [68] "Shooting Mixed Trap"                                                                  
##  [69] "Athletics Men's Hammer Throw"                                                         
##  [70] "Athletics Women's 400 metres Hurdles"                                                 
##  [71] "Judo Women's Half-Lightweight"                                                        
##  [72] "Alpine Skiing Men's Super G"                                                          
##  [73] "Alpine Skiing Men's Slalom"                                                           
##  [74] "Shooting Women's Sporting Pistol, 25 metres"                                          
##  [75] "Alpine Skiing Men's Giant Slalom"                                                     
##  [76] "Weightlifting Women's Lightweight"                                                    
##  [77] "Weightlifting Men's Heavyweight II"                                                   
##  [78] "Judo Men's Half-Middleweight"                                                         
##  [79] "Athletics Women's 400 metres"                                                         
##  [80] "Athletics Women's 3,000 metres Steeplechase"                                          
##  [81] "Swimming Women's 100 metres Freestyle"                                                
##  [82] "Shooting Women's Air Pistol, 10 metres"                                               
##  [83] "Shooting Men's Rapid-Fire Pistol, 25 metres"                                          
##  [84] "Weightlifting Men's Featherweight"                                                    
##  [85] "Alpine Skiing Women's Giant Slalom"                                                   
##  [86] "Athletics Women's Heptathlon"                                                         
##  [87] "Athletics Women's Javelin Throw"                                                      
##  [88] "Weightlifting Women's Featherweight"                                                  
##  [89] "Swimming Women's 50 metres Freestyle"                                                 
##  [90] "Shooting Men's Free Pistol, 50 metres"                                                
##  [91] "Swimming Women's 100 metres Butterfly"                                                
##  [92] "Shooting Mixed Free Pistol, 50 metres"                                                
##  [93] "Alpine Skiing Women's Slalom"                                                         
##  [94] "Wrestling Men's Heavyweight, Greco-Roman"                                             
##  [95] "Swimming Men's 100 metres Breaststroke"                                               
##  [96] "Athletics Women's Triple Jump"                                                        
##  [97] "Cycling Men's Road Race, Individual"                                                  
##  [98] "Swimming Women's 400 metres Individual Medley"                                        
##  [99] "Gymnastics Women's Balance Beam"                                                      
## [100] "Weightlifting Women's Middleweight"                                                   
## [101] "Swimming Men's 4 x 200 metres Freestyle Relay"                                        
## [102] "Athletics Women's 1,500 metres"                                                       
## [103] "Gymnastics Women's Individual All-Around"                                             
## [104] "Cross Country Skiing Men's 50 kilometres"                                             
## [105] "Athletics Men's 5,000 metres"                                                         
## [106] "Rowing Men's Lightweight Double Sculls"                                               
## [107] "Fencing Men's epee, Individual"                                                       
## [108] "Handball Men's Handball"                                                              
## [109] "Athletics Men's 800 metres"                                                           
## [110] "Boxing Men's Heavyweight"                                                             
## [111] "Athletics Men's 1,500 metres"                                                         
## [112] "Gymnastics Women's Floor Exercise"                                                    
## [113] "Judo Men's Lightweight"                                                               
## [114] "Gymnastics Women's Uneven Bars"                                                       
## [115] "Athletics Women's 20 kilometres Walk"                                                 
## [116] "Volleyball Women's Volleyball"                                                        
## [117] "Swimming Men's 200 metres Breaststroke"                                               
## [118] "Table Tennis Men's Singles"                                                           
## [119] "Trampolining Men's Individual"                                                        
## [120] "Judo Women's Heavyweight"                                                             
## [121] "Athletics Men's 10,000 metres"                                                        
## [122] "Athletics Men's 4 x 400 metres Relay"                                                 
## [123] "Fencing Men's Foil, Individual"                                                       
## [124] "Athletics Men's High Jump"                                                            
## [125] "Boxing Men's Super-Heavyweight"                                                       
## [126] "Athletics Men's 3,000 metres Steeplechase"                                            
## [127] "Swimming Men's 100 metres Butterfly"                                                  
## [128] "Wrestling Men's Light-Heavyweight, Greco-Roman"                                       
## [129] "Weightlifting Men's Heavyweight I"                                                    
## [130] "Judo Men's Extra-Lightweight"                                                         
## [131] "Boxing Men's Light-Flyweight"                                                         
## [132] "Boxing Men's Light-Middleweight"                                                      
## [133] "Athletics Men's 20 kilometres Walk"                                                   
## [134] "Volleyball Men's Volleyball"                                                          
## [135] "Boxing Men's Middleweight"                                                            
## [136] "Boxing Men's Light-Heavyweight"                                                       
## [137] "Judo Women's Extra-Lightweight"                                                       
## [138] "Wrestling Men's Welterweight, Greco-Roman"                                            
## [139] "Fencing Women's epee, Individual"                                                     
## [140] "Swimming Men's 200 metres Individual Medley"                                          
## [141] "Fencing Women's Sabre, Individual"                                                    
## [142] "Gymnastics Men's Rings"                                                               
## [143] "Alpine Skiing Women's Super G"                                                        
## [144] "Table Tennis Men's Doubles"                                                           
## [145] "Boxing Men's Light-Welterweight"                                                      
## [146] "Rowing Men's Single Sculls"                                                           
## [147] "Badminton Men's Singles"                                                              
## [148] "Gymnastics Men's Parallel Bars"                                                       
## [149] "Fencing Men's Sabre, Team"                                                            
## [150] "Cross Country Skiing Men's 15 kilometres"                                             
## [151] "Swimming Men's 200 metres Butterfly"                                                  
## [152] "Gymnastics Men's Horizontal Bar"                                                      
## [153] "Wrestling Men's Middleweight, Greco-Roman"                                            
## [154] "Tennis Men's Singles"                                                                 
## [155] "Gymnastics Men's Floor Exercise"                                                      
## [156] "Rowing Women's Single Sculls"                                                         
## [157] "Athletics Men's Decathlon"                                                            
## [158] "Table Tennis Women's Doubles"                                                         
## [159] "Gymnastics Men's Pommelled Horse"                                                     
## [160] "Table Tennis Women's Singles"                                                         
## [161] "Tennis Women's Singles"                                                               
## [162] "Judo Women's Lightweight"                                                             
## [163] "Athletics Women's Marathon"                                                           
## [164] "Shooting Men's Air Rifle, 10 metres"                                                  
## [165] "Athletics Men's Triple Jump"                                                          
## [166] "Athletics Women's 5,000 metres"                                                       
## [167] "Athletics Men's 400 metres Hurdles"                                                   
## [168] "Gymnastics Men's Individual All-Around"                                               
## [169] "Swimming Men's 100 metres Backstroke"                                                 
## [170] "Weightlifting Women's Super-Heavyweight"                                              
## [171] "Gymnastics Men's Horse Vault"                                                         
## [172] "Weightlifting Men's Super-Heavyweight"                                                
## [173] "Alpine Skiing Women's Downhill"                                                       
## [174] "Judo Women's Half-Middleweight"                                                       
## [175] "Athletics Women's 10,000 metres"                                                      
## [176] "Sailing Women's One Person Dinghy"                                                    
## [177] "Alpine Skiing Men's Downhill"                                                         
## [178] "Sailing Men's Two Person Dinghy"                                                      
## [179] "Canoeing Women's Kayak Singles, Slalom"                                               
## [180] "Alpine Skiing Men's Combined"                                                         
## [181] "Snowboarding Men's Boardercross"                                                      
## [182] "Biathlon Women's 15 kilometres"                                                       
## [183] "Biathlon Women's 7.5 kilometres Sprint"                                               
## [184] "Cross Country Skiing Men's 30 km Skiathlon"                                           
## [185] "Athletics Women's High Jump"                                                          
## [186] "Cross Country Skiing Men's Sprint"                                                    
## [187] "Swimming Women's 200 metres Individual Medley"                                        
## [188] "Alpine Skiing Women's Combined"                                                       
## [189] "Swimming Men's 400 metres Individual Medley"                                          
## [190] "Basketball Women's Basketball"                                                        
## [191] "Handball Women's Handball"                                                            
## [192] "Beach Volleyball Men's Beach Volleyball"                                              
## [193] "Basketball Men's Basketball"                                                          
## [194] "Canoeing Men's Canadian Doubles, 1,000 metres"                                        
## [195] "Canoeing Men's Canadian Singles, 1,000 metres"                                        
## [196] "Swimming Men's 4 x 100 metres Medley Relay"                                           
## [197] "Athletics Women's 3,000 metres"                                                       
## [198] "Canoeing Men's Canadian Singles, 200 metres"                                          
## [199] "Swimming Women's 200 metres Breaststroke"                                             
## [200] "Swimming Women's 100 metres Breaststroke"                                             
## [201] "Sailing Men's One Person Dinghy"                                                      
## [202] "Canoeing Men's Canadian Singles, 500 metres"                                          
## [203] "Cycling Men's 1,000 metres Time Trial"                                                
## [204] "Cycling Men's Mountainbike, Cross-Country"                                            
## [205] "Sailing Mixed Two Person Keelboat"                                                    
## [206] "Athletics Women's 4 x 400 metres Relay"                                               
## [207] "Athletics Women's 4 x 100 metres Relay"                                               
## [208] "Cycling Men's Individual Pursuit, 4,000 metres"                                       
## [209] "Cycling Men's Sprint"                                                                 
## [210] "Canoeing Women's Kayak Singles, 500 metres"                                           
## [211] "Cycling Men's Points Race"                                                            
## [212] "Rowing Men's Coxed Eights"                                                            
## [213] "Tennis Men's Singles, Covered Courts"                                                 
## [214] "Rugby Men's Rugby"                                                                    
## [215] "Shooting Men's Small-Bore Rifle, Moving Target, 25 yards"                             
## [216] "Diving Men's Springboard"                                                             
## [217] "Shooting Men's Small-Bore Rifle, Disappearing Target, 25 yards"                       
## [218] "Athletics Men's 10 mile Walk"                                                         
## [219] "Swimming Men's 1,500 metres Freestyle"                                                
## [220] "Swimming Men's 400 metres Breaststroke"                                               
## [221] "Athletics Men's 3,500 metres Walk"                                                    
## [222] "Athletics Men's 5 mile"                                                               
## [223] "Athletics Men's 10 kilometres Walk"                                                   
## [224] "Shooting Men's Small-Bore Rifle, Prone, 50 and 100 yards"                             
## [225] "Athletics Men's Standing High Jump"                                                   
## [226] "Cycling Women's Mountainbike, Cross-Country"                                          
## [227] "Cycling Men's Team Pursuit, 4,000 metres"                                             
## [228] "Tennis Men's Doubles"                                                                 
## [229] "Shooting Men's Small-Bore Rifle, Prone, 50 metres"                                    
## [230] "Shooting Men's Skeet"                                                                 
## [231] "Equestrianism Men's Three-Day Event, Team"                                            
## [232] "Equestrianism Mixed Three-Day Event, Team"                                            
## [233] "Hockey Women's Hockey"                                                                
## [234] "Rugby Sevens Men's Rugby Sevens"                                                      
## [235] "Bobsleigh Men's Four/Five"                                                            
## [236] "Athletics Men's Discus Throw"                                                         
## [237] "Fencing Women's Foil, Team"                                                           
## [238] "Rowing Men's Coxless Pairs"                                                           
## [239] "Swimming Men's 200 metres Backstroke"                                                 
## [240] "Equestrianism Mixed Jumping, Individual"                                              
## [241] "Fencing Men's epee, Team"                                                             
## [242] "Water Polo Men's Water Polo"                                                          
## [243] "Rowing Women's Lightweight Double Sculls"                                             
## [244] "Rowing Men's Coxed Fours"                                                             
## [245] "Sailing Mixed Multihull"                                                              
## [246] "Swimming Women's 400 metres Freestyle"                                                
## [247] "Athletics Women's Pole Vault"                                                         
## [248] "Equestrianism Men's Jumping, Team"                                                    
## [249] "Sailing Mixed 6 metres"                                                               
## [250] "Cross Country Skiing Men's 30 kilometres"                                             
## [251] "Taekwondo Women's Welterweight"                                                       
## [252] "Fencing Men's Foil, Team"                                                             
## [253] "Rowing Men's Coxless Fours"                                                           
## [254] "Rowing Men's Lightweight Coxless Fours"                                               
## [255] "Equestrianism Men's Three-Day Event, Individual"                                      
## [256] "Polo Men's Polo"                                                                      
## [257] "Canoeing Women's Kayak Doubles, 500 metres"                                           
## [258] "Swimming Women's 800 metres Freestyle"                                                
## [259] "Sailing Mixed 8 metres"                                                               
## [260] "Equestrianism Men's Jumping, Individual"                                              
## [261] "Equestrianism Mixed Jumping, Team"                                                    
## [262] "Rowing Women's Coxless Pairs"                                                         
## [263] "Cycling Men's 100 kilometres Team Time Trial"                                         
## [264] "Canoeing Men's Kayak Fours, 1,000 metres"                                             
## [265] "Rowing Men's Coxed Pairs"                                                             
## [266] "Shooting Women's Skeet"                                                               
## [267] "Swimming Women's 200 metres Butterfly"                                                
## [268] "Athletics Men's 50 kilometres Walk"                                                   
## [269] "Gymnastics Women's Horse Vault"                                                       
## [270] "Cross Country Skiing Men's 10 kilometres"                                             
## [271] "Cycling Men's Madison"                                                                
## [272] "Cross Country Skiing Women's 30 kilometres"                                           
## [273] "Swimming Women's 10 kilometres Open Water"                                            
## [274] "Rowing Men's Double Sculls"                                                           
## [275] "Biathlon Men's 20 kilometres"                                                         
## [276] "Athletics Women's Shot Put"                                                           
## [277] "Athletics Women's Discus Throw"                                                       
## [278] "Cross Country Skiing Women's 5 kilometres"                                            
## [279] "Cross Country Skiing Men's 4 x 10 kilometres Relay"                                   
## [280] "Football Women's Football"                                                            
## [281] "Canoeing Men's Kayak Doubles, 1,000 metres"                                           
## [282] "Sailing Women's Skiff"                                                                
## [283] "Biathlon Men's 10 kilometres Sprint"                                                  
## [284] "Biathlon Men's 4 x 7.5 kilometres Relay"                                              
## [285] "Beach Volleyball Women's Beach Volleyball"                                            
## [286] "Canoeing Men's Kayak Doubles, 500 metres"                                             
## [287] "Rowing Men's Quadruple Sculls"                                                        
## [288] "Athletics Women's Long Jump"                                                          
## [289] "Diving Women's Platform"                                                              
## [290] "Cycling Men's BMX"                                                                    
## [291] "Cross Country Skiing Men's 10/15 kilometres Pursuit"                                  
## [292] "Art Competitions Mixed Unknown Event"                                                 
## [293] "Wrestling Women's Flyweight, Freestyle"                                               
## [294] "Cycling Men's Road Race, Team"                                                        
## [295] "Athletics Women's 80 metres Hurdles"                                                  
## [296] "Skeleton Men's Skeleton"                                                              
## [297] "Shooting Mixed Running Target, 50 metres"                                             
## [298] "Freestyle Skiing Men's Moguls"                                                        
## [299] "Cross Country Skiing Women's 5/10 kilometres Pursuit"                                 
## [300] "Swimming Women's 200 metres Freestyle"                                                
## [301] "Canoeing Men's Kayak Singles, 1,000 metres"                                           
## [302] "Sailing Mixed Three Person Keelboat"                                                  
## [303] "Modern Pentathlon Men's Individual"                                                   
## [304] "Swimming Women's 4 x 100 metres Medley Relay"                                         
## [305] "Cycling Men's 50 kilometres"                                                          
## [306] "Canoeing Women's Kayak Fours, 500 metres"                                             
## [307] "Swimming Women's 4 x 100 metres Freestyle Relay"                                      
## [308] "Athletics Women's Hammer Throw"                                                       
## [309] "Swimming Men's 10 kilometres Open Water"                                              
## [310] "Cross Country Skiing Women's 15 kilometres"                                           
## [311] "Modern Pentathlon Men's Team"                                                         
## [312] "Wrestling Men's Super-Heavyweight, Greco-Roman"                                       
## [313] "Canoeing Men's Kayak Singles, 500 metres"                                             
## [314] "Bobsleigh Men's Four"                                                                 
## [315] "Tennis Women's Doubles"                                                               
## [316] "Shooting Men's Free Rifle, Three Positions, 300 metres"                               
## [317] "Canoeing Men's Canadian Singles, Slalom"                                              
## [318] "Sailing Mixed 5.5 metres"                                                             
## [319] "Shooting Men's Small-Bore Rifle, Three Positions, 50 metres"                          
## [320] "Canoeing Men's Kayak Singles, Slalom"                                                 
## [321] "Shooting Mixed Skeet"                                                                 
## [322] "Equestrianism Men's Dressage, Team"                                                   
## [323] "Athletics Men's Pole Vault"                                                           
## [324] "Swimming Women's 200 metres Backstroke"                                               
## [325] "Gymnastics Men's Team All-Around"                                                     
## [326] "Sailing Mixed Two Person Dinghy"                                                      
## [327] "Cycling Men's Omnium"                                                                 
## [328] "Shooting Mixed Rapid-Fire Pistol, 25 metres"                                          
## [329] "Taekwondo Women's Flyweight"                                                          
## [330] "Athletics Women's 100 metres Hurdles"                                                 
## [331] "Modern Pentathlon Women's Individual"                                                 
## [332] "Tennis Mixed Doubles"                                                                 
## [333] "Canoeing Men's Kayak Doubles, 200 metres"                                             
## [334] "Figure Skating Men's Singles"                                                         
## [335] "Sailing Women's Two Person Dinghy"                                                    
## [336] "Triathlon Women's Olympic Distance"                                                   
## [337] "Archery Men's Individual"                                                             
## [338] "Canoeing Men's Kayak Singles, 200 metres"                                             
## [339] "Sailing Men's Skiff"                                                                  
## [340] "Canoeing Women's Kayak Singles, 200 metres"                                           
## [341] "Cycling Men's Individual Time Trial"                                                  
## [342] "Equestrianism Men's Dressage, Individual"                                             
## [343] "Diving Women's Springboard"                                                           
## [344] "Shooting Mixed Small-Bore Rifle, Three Positions, 50 metres"                          
## [345] "Rowing Women's Double Sculls"                                                         
## [346] "Judo Women's Half-Heavyweight"                                                        
## [347] "Weightlifting Women's Heavyweight"                                                    
## [348] "Wrestling Men's Super-Heavyweight, Freestyle"                                         
## [349] "Swimming Women's 4 x 200 metres Freestyle Relay"                                      
## [350] "Snowboarding Men's Giant Slalom"                                                      
## [351] "Sailing Men's One Person Heavyweight Dinghy"                                          
## [352] "Freestyle Skiing Men's Aerials"                                                       
## [353] "Shooting Women's Small-Bore Rifle, Three Positions, 50 metres"                        
## [354] "Luge Women's Singles"                                                                 
## [355] "Equestrianism Mixed Dressage, Individual"                                             
## [356] "Cycling Women's BMX"                                                                  
## [357] "Wrestling Men's Flyweight, Greco-Roman"                                               
## [358] "Judo Men's Open Class"                                                                
## [359] "Golf Men's Individual"                                                                
## [360] "Cycling Men's Tandem Sprint, 2,000 metres"                                            
## [361] "Figure Skating Women's Singles"                                                       
## [362] "Cross Country Skiing Women's 10 kilometres"                                           
## [363] "Figure Skating Mixed Ice Dancing"                                                     
## [364] "Cross Country Skiing Women's Sprint"                                                  
## [365] "Cross Country Skiing Men's Team Sprint"                                               
## [366] "Cross Country Skiing Men's 10/10 kilometres Pursuit"                                  
## [367] "Weightlifting Women's Light-Heavyweight"                                              
## [368] "Cross Country Skiing Women's 5/5 kilometres Pursuit"                                  
## [369] "Figure Skating Mixed Pairs"                                                           
## [370] "Diving Men's Platform"                                                                
## [371] "Cycling Women's Individual Time Trial"                                                
## [372] "Rugby Sevens Women's Rugby Sevens"                                                    
## [373] "Swimming Men's 4 x 100 metres Freestyle Relay"                                        
## [374] "Archery Men's Team"                                                                   
## [375] "Rowing Women's Quadruple Sculls"                                                      
## [376] "Softball Women's Softball"                                                            
## [377] "Trampolining Women's Individual"                                                      
## [378] "Shooting Women's Double Trap"                                                         
## [379] "Synchronized Swimming Women's Team"                                                   
## [380] "Sailing Mixed Two Person Heavyweight Dinghy"                                          
## [381] "Taekwondo Men's Heavyweight"                                                          
## [382] "Baseball Men's Baseball"                                                              
## [383] "Speed Skating Women's 500 metres"                                                     
## [384] "Water Polo Women's Water Polo"                                                        
## [385] "Cycling Women's 500 metres Time Trial"                                                
## [386] "Cycling Women's Road Race, Individual"                                                
## [387] "Cycling Women's Team Pursuit"                                                         
## [388] "Freestyle Skiing Women's Moguls"                                                      
## [389] "Cycling Men's Team Sprint"                                                            
## [390] "Canoeing Men's Canadian Doubles, Slalom"                                              
## [391] "Gymnastics Women's Team All-Around"                                                   
## [392] "Cycling Men's Keirin"                                                                 
## [393] "Skeleton Women's Skeleton"                                                            
## [394] "Freestyle Skiing Women's Aerials"                                                     
## [395] "Short Track Speed Skating Women's 1,500 metres"                                       
## [396] "Snowboarding Men's Halfpipe"                                                          
## [397] "Rowing Women's Coxed Eights"                                                          
## [398] "Sailing Women's Three Person Keelboat"                                                
## [399] "Archery Women's Individual"                                                           
## [400] "Cycling Women's Individual Pursuit, 3,000 metres"                                     
## [401] "Snowboarding Women's Boardercross"                                                    
## [402] "Snowboarding Women's Parallel Giant Slalom"                                           
## [403] "Taekwondo Women's Heavyweight"                                                        
## [404] "Snowboarding Men's Parallel Giant Slalom"                                             
## [405] "Speed Skating Men's 1,500 metres"                                                     
## [406] "Table Tennis Women's Team"                                                            
## [407] "Short Track Speed Skating Men's 5,000 metres Relay"                                   
## [408] "Rhythmic Gymnastics Women's Individual"                                               
## [409] "Snowboarding Women's Halfpipe"                                                        
## [410] "Cycling Women's Omnium"                                                               
## [411] "Diving Women's Synchronized Springboard"                                              
## [412] "Cycling Women's Points Race"                                                          
## [413] "Ice Hockey Men's Ice Hockey"                                                          
## [414] "Speed Skating Women's 1,000 metres"                                                   
## [415] "Short Track Speed Skating Women's 1,000 metres"                                       
## [416] "Speed Skating Men's 10,000 metres"                                                    
## [417] "Bobsleigh Women's Two"                                                                
## [418] "Badminton Women's Doubles"                                                            
## [419] "Freestyle Skiing Men's Ski Cross"                                                     
## [420] "Swimming Men's 200 metres Obstacle Course"                                            
## [421] "Table Tennis Men's Team"                                                              
## [422] "Badminton Mixed Doubles"                                                              
## [423] "Speed Skating Men's 500 metres"                                                       
## [424] "Shooting Men's Running Target, 10 metres"                                             
## [425] "Badminton Women's Singles"                                                            
## [426] "Diving Men's Synchronized Springboard"                                                
## [427] "Shooting Women's Trap"                                                                
## [428] "Diving Men's Synchronized Platform"                                                   
## [429] "Athletics Women's 10 kilometres Walk"                                                 
## [430] "Cycling Women's Team Sprint"                                                          
## [431] "Sailing Mixed Skiff"                                                                  
## [432] "Short Track Speed Skating Men's 1,000 metres"                                         
## [433] "Badminton Men's Doubles"                                                              
## [434] "Snowboarding Women's Slopestyle"                                                      
## [435] "Speed Skating Men's 5,000 metres"                                                     
## [436] "Alpinism Mixed Alpinism"                                                              
## [437] "Rowing Women's Coxless Fours"                                                         
## [438] "Canoeing Men's Canadian Singles, 10,000 metres"                                       
## [439] "Taekwondo Women's Featherweight"                                                      
## [440] "Athletics Men's Pentathlon"                                                           
## [441] "Athletics Women's Pentathlon"                                                         
## [442] "Shooting Men's Running Target, Single And Double Shot"                                
## [443] "Cross Country Skiing Men's 18 kilometres"                                             
## [444] "Cross Country Skiing Women's 15 km Skiathlon"                                         
## [445] "Art Competitions Mixed Music"                                                         
## [446] "Freestyle Skiing Women's Halfpipe"                                                    
## [447] "Freestyle Skiing Women's Slopestyle"                                                  
## [448] "Canoeing Men's Kayak Singles, 10,000 metres"                                          
## [449] "Boxing Women's Middleweight"                                                          
## [450] "Diving Women's Synchronized Platform"                                                 
## [451] "Canoeing Men's Kayak Relay 4 x 500 metres"                                            
## [452] "Short Track Speed Skating Women's 500 metres"                                         
## [453] "Sailing Men's Two Person Keelboat"                                                    
## [454] "Speed Skating Men's 1,000 metres"                                                     
## [455] "Cycling Women's Sprint"                                                               
## [456] "Equestrianism Mixed Dressage, Team"                                                   
## [457] "Rowing Women's Coxed Fours"                                                           
## [458] "Canoeing Men's Kayak Doubles, 10,000 metres"                                          
## [459] "Nordic Combined Men's Individual"                                                     
## [460] "Short Track Speed Skating Men's 500 metres"                                           
## [461] "Archery Women's Team"                                                                 
## [462] "Short Track Speed Skating Men's 1,500 metres"                                         
## [463] "Diving Men's Plain High"                                                              
## [464] "Freestyle Skiing Men's Slopestyle"                                                    
## [465] "Cycling Women's Keirin"                                                               
## [466] "Athletics Men's 3,000 metres Walk"                                                    
## [467] "Athletics Men's 5,000 metres, Team"                                                   
## [468] "Weightlifting Men's Flyweight"                                                        
## [469] "Athletics Men's 60 metres"                                                            
## [470] "Swimming Men's 220 yard Freestyle"                                                    
## [471] "Swimming Men's 440 yard Freestyle"                                                    
## [472] "Art Competitions Mixed Painting, Unknown Event"                                       
## [473] "Swimming Men's One Mile Freestyle"                                                    
## [474] "Freestyle Skiing Women's Ski Cross"                                                   
## [475] "Canoeing Men's Canadian Doubles, 10,000 metres"                                       
## [476] "Snowboarding Men's Slopestyle"                                                        
## [477] "Shooting Men's Running Target, 50 metres"                                             
## [478] "Swimming Men's 880 yard Freestyle"                                                    
## [479] "Golf Women's Individual"                                                              
## [480] "Boxing Women's Lightweight"                                                           
## [481] "Swimming Women's 300 metres Freestyle"                                                
## [482] "Diving Women's Plain High"                                                            
## [483] "Nordic Combined Men's Team"                                                           
## [484] "Ski Jumping Men's Large Hill, Individual"                                             
## [485] "Ski Jumping Men's Normal Hill, Individual"                                            
## [486] "Art Competitions Mixed Music, Unknown Event"                                          
## [487] "Shooting Men's Dueling Pistol Au Vise 20 metres"                                      
## [488] "Ski Jumping Men's Large Hill, Team"                                                   
## [489] "Ski Jumping Women's Normal Hill, Individual"                                          
## [490] "Art Competitions Mixed Painting, Applied Arts"                                        
## [491] "Equestrianism Mixed Four-In-Hand Competition"                                         
## [492] "Nordic Combined Men's Large Hill / 10 km, Individual"                                 
## [493] "Athletics Men's Discus Throw, Greek Style"                                            
## [494] "Snowboarding Women's Giant Slalom"                                                    
## [495] "Art Competitions Mixed Architecture, Architectural Designs"                           
## [496] "Biathlon Men's 12.5 kilometres Pursuit"                                               
## [497] "Art Competitions Mixed Architecture, Designs For Town Planning"                       
## [498] "Nordic Combined Men's Normal Hill / 10 km, Individual"                                
## [499] "Tug-Of-War Men's Tug-Of-War"                                                          
## [500] "Fencing Men's Sabre, Individual, Three Hits"                                          
## [501] "Cross Country Skiing Women's 20 kilometres"                                           
## [502] "Art Competitions Mixed Literature, Unknown Event"                                     
## [503] "Gymnastics Women's Team Portable Apparatus"                                           
## [504] "Weightlifting Men's Unlimited, One Hand"                                              
## [505] "Cycling Men's 5,000 metres"                                                           
## [506] "Athletics Men's 2,500 metres Steeplechase"                                            
## [507] "Art Competitions Mixed Sculpturing, Unknown Event"                                    
## [508] "Art Competitions Mixed Painting, Paintings"                                           
## [509] "Weightlifting Men's Unlimited, Two Hands"                                             
## [510] "Art Competitions Mixed Literature, Epic Works"                                        
## [511] "Luge Mixed (Men)'s Doubles"                                                           
## [512] "Equestrianism Mixed High Jump"                                                        
## [513] "Shooting Men's Running Target, Single Shot, Team"                                     
## [514] "Cycling Men's 333 metres Time Trial"                                                  
## [515] "Shooting Men's Running Target, Single Shot"                                           
## [516] "Shooting Men's Free Rifle, Any Position, 300 metres"                                  
## [517] "Swimming Men's Underwater Swimming"                                                   
## [518] "Art Competitions Mixed Architecture, Unknown Event"                                   
## [519] "Biathlon Mixed 2 x 6 kilometres and 2 x 7.5 kilometres Relay"                         
## [520] "Swimming Men's 4,000 metres Freestyle"                                                
## [521] "Cycling Men's 20 kilometres"                                                          
## [522] "Cycling Men's 12-Hours Race"                                                          
## [523] "Art Competitions Mixed Sculpturing, Statues"                                          
## [524] "Athletics Men's Pentathlon (Ancient)"                                                 
## [525] "Shooting Men's Military Rifle, Kneeling Or Standing, 300 metres"                      
## [526] "Gymnastics Men's Individual All-Around, Field Sports"                                 
## [527] "Shooting Men's Military Revolver, 1873-1874 Gras Model, 20 metres"                    
## [528] "Art Competitions Mixed Sculpturing, Medals And Plaques"                               
## [529] "Canoeing Men's Folding Kayak Doubles, 10 kilometres"                                  
## [530] "Nordic Combined Men's Sprint"                                                         
## [531] "Gymnastics Men's Individual All-Around, Apparatus Work"                               
## [532] "Cross Country Skiing Women's 4 x 5 kilometres Relay"                                  
## [533] "Shooting Men's Military Revolver, 20 metres"                                          
## [534] "Cycling Men's 100 kilometres"                                                         
## [535] "Speed Skating Women's 5,000 metres"                                                   
## [536] "Speed Skating Women's 1,500 metres"                                                   
## [537] "Shooting Men's Trap, Team"                                                            
## [538] "Shooting Men's Dueling Pistol, 30 metres"                                             
## [539] "Snowboarding Women's Parallel Slalom"                                                 
## [540] "Equestrianism Mixed Long Jump"                                                        
## [541] "Equestrianism Mixed Hacks And Hunter Combined"                                        
## [542] "Biathlon Men's 15 kilometres Mass Start"                                              
## [543] "Speed Skating Women's 3,000 metres"                                                   
## [544] "Cycling Men's 10,000 metres"                                                          
## [545] "Athletics Men's 1,500 metres Walk"                                                    
## [546] "Athletics Men's Discus Throw, Both Hands"                                             
## [547] "Shooting Men's Dueling Pistol Au Commandement, 25 metres"                             
## [548] "Athletics Men's Standing Long Jump"                                                   
## [549] "Shooting Men's Running Target, Double Shot"                                           
## [550] "Art Competitions Mixed Literature, Lyric Works"                                       
## [551] "Swimming Men's 4 x 250 metres Freestyle Relay"                                        
## [552] "Wrestling Men's Middleweight B, Greco-Roman"                                          
## [553] "Snowboarding Men's Parallel Slalom"                                                   
## [554] "Art Competitions Mixed Painting, Drawings And Water Colors"                           
## [555] "Art Competitions Mixed Sculpturing, Medals And Reliefs"                               
## [556] "Rowing Men's Coxed Fours, Outriggers"                                                 
## [557] "Shooting Men's Military Rifle, 1873-1874 Gras Model, Kneeling Or Standing, 200 metres"
## [558] "Wrestling Men's Middleweight A, Greco-Roman"                                          
## [559] "Fencing Men's Sabre, Masters, Individual"                                             
## [560] "Wrestling Men's All-Around, Greco-Roman"                                              
## [561] "Swimming Men's 1,000 metres Freestyle"                                                
## [562] "Cross Country Skiing Women's Team Sprint"                                             
## [563] "Freestyle Skiing Men's Halfpipe"                                                      
## [564] "Athletics Men's Stone Throw"                                                          
## [565] "Art Competitions Mixed Painting, Graphic Arts"                                        
## [566] "Biathlon Women's 10 kilometres Pursuit"                                               
## [567] "Luge Mixed Team Relay"                                                                
## [568] "Canoeing Men's Folding Kayak Singles, 10 kilometres"                                  
## [569] "Shooting Men's Military Rifle, Three Positions, 300 metres"                           
## [570] "Wrestling Women's Heavyweight, Freestyle"                                             
## [571] "Shooting Men's Military Rifle, Any Position, 600 metres"                              
## [572] "Swimming Men's 500 metres Freestyle"                                                  
## [573] "Athletics Men's Cross-Country, Individual"                                            
## [574] "Swimming Men's 1,200 metres Freestyle"                                                
## [575] "Rhythmic Gymnastics Women's Group"                                                    
## [576] "Wrestling Women's Lightweight, Freestyle"                                             
## [577] "Wrestling Women's Featherweight, Freestyle"                                           
## [578] "Wrestling Women's Middleweight, Freestyle"                                            
## [579] "Wrestling Men's Light-Flyweight, Greco-Roman"                                         
## [580] "Archery Men's Sur La Perche a La Pyramide"                                            
## [581] "Archery Men's Target Archery, 33 metres, Team"                                        
## [582] "Shooting Men's Free Rifle, Three Positions, 300 metres, Team"                         
## [583] "Shooting Men's Military Rifle, Standing, 300 metres, Team"                            
## [584] "Archery Men's Target Archery, 50 metres, Team"                                        
## [585] "Athletics Men's 3,000 metres, Team"                                                   
## [586] "Archery Men's Target Archery, 28 metres, Team"                                        
## [587] "Archery Men's Pole Archery, Large Birds, Individual"                                  
## [588] "Shooting Men's Military Rifle, 300 metres and 600 metres, Prone, Team"                
## [589] "Gymnastics Men's Team All-Around, Swedish System"                                     
## [590] "Shooting Men's Free Pistol, 50 metres, Team"                                          
## [591] "Shooting Men's Free Rifle, Prone, 600 metres"                                         
## [592] "Shooting Men's Military Rifle, Prone, 600 metres, Team"                               
## [593] "Shooting Men's Military Pistol, Team"                                                 
## [594] "Shooting Men's Free Pistol, 50 yards"                                                 
## [595] "Art Competitions Mixed Sculpturing"                                                   
## [596] "Art Competitions Mixed Architecture"                                                  
## [597] "Shooting Men's Free Rifle, 400, 600 and 800 metres, Team"                             
## [598] "Athletics Men's Cross-Country, Team"                                                  
## [599] "Archery Men's Pole Archery, Small Birds, Individual"                                  
## [600] "Archery Men's Pole Archery, Large Birds, Team"                                        
## [601] "Shooting Men's Military Rifle, Prone, 300 metres, Team"                               
## [602] "Equestrianism Men's Vaulting, Individual"                                             
## [603] "Art Competitions Mixed Painting"                                                      
## [604] "Archery Men's Pole Archery, Small Birds, Team"                                        
## [605] "Shooting Men's Free Rifle, Kneeling, 300 metres"                                      
## [606] "Shooting Men's Small-Bore Rifle, Standing, 50 metres"                                 
## [607] "Archery Men's Sur La Perche a La Herse"                                               
## [608] "Art Competitions Mixed Literature"                                                    
## [609] "Fencing Men's Foil, Masters, Individual"                                              
## [610] "Shooting Men's Small Bore-Rifle, Standing, 50 metres, Team"                           
## [611] "Shooting Men's Free Pistol, 50 yards, Team"                                           
## [612] "Shooting Men's Free Rifle, Prone, 300 metres"                                         
## [613] "Shooting Men's Free Rifle, Standing, 300 metres"                                      
## [614] "Art Competitions Mixed Sculpturing, Medals"                                           
## [615] "Speed Skating Men's Allround"                                                         
## [616] "Equestrianism Men's Vaulting, Team"                                                   
## [617] "Fencing Men's epee, Masters, Individual"                                              
## [618] "Art Competitions Mixed Music, Instrumental And Chamber"                               
## [619] "Shooting Men's Military Rifle, Standing, 300 metres"                                  
## [620] "Archery Men's Au Chapelet, 33 metres"                                                 
## [621] "Archery Men's Target Archery, 28 metres, Individual"                                  
## [622] "Archery Men's Target Archery, 50 metres, Individual"                                  
## [623] "Shooting Men's Unknown Event"                                                         
## [624] "Archery Men's Au Chapelet, 50 metres"                                                 
## [625] "Rowing Men's Coxed Pairs (1 kilometres)"                                              
## [626] "Archery Men's Au Cordon Dore, 33 metres"                                              
## [627] "Archery Men's Championnat Du Monde"                                                   
## [628] "Archery Men's Target Archery, 33 metres, Individual"                                  
## [629] "Art Competitions Mixed Music, Compositions For Orchestra"                             
## [630] "Archery Men's Au Cordon Dore, 50 metres"                                              
## [631] "Rowing Men's Coxed Pairs (1 mile)"                                                    
## [632] "Biathlon Women's 4 x 6 kilometres Relay"                                              
## [633] "Biathlon Women's 12.5 kilometres Mass Start"                                          
## [634] "Canoeing Men's Canadian Doubles, 500 metres"                                          
## [635] "Biathlon Women's 4 x 7.5 kilometres Relay"                                            
## [636] "Gymnastics Men's Rope Climbing"                                                       
## [637] "Athletics Men's Javelin Throw, Freestyle"                                             
## [638] "Shooting Men's Free Pistol, 25 metres"                                                
## [639] "Gymnastics Men's Individual All-Around, 5 Events"                                     
## [640] "Shooting Men's Military Pistol, 30 metres"                                            
## [641] "Weightlifting Women's Flyweight"                                                      
## [642] "Wrestling Women's Light-Heavyweight, Freestyle"                                       
## [643] "Fencing Women's epee, Team"                                                           
## [644] "Boxing Women's Flyweight"                                                             
## [645] "Short Track Speed Skating Women's 3,000 metres Relay"                                 
## [646] "Rowing Women's Coxed Quadruple Sculls"                                                
## [647] "Cross Country Skiing Women's 3 x 5 kilometres Relay"                                  
## [648] "Biathlon Women's 3 x 7.5 kilometres Relay"                                            
## [649] "Lacrosse Men's Lacrosse"                                                              
## [650] "Curling Women's Curling"                                                              
## [651] "Shooting Men's Free Rifle, 1,000 Yards"                                               
## [652] "Ice Hockey Women's Ice Hockey"                                                        
## [653] "Figure Skating Mixed Team"                                                            
## [654] "Curling Men's Curling"                                                                
## [655] "Cycling Men's Team Pursuit, 1,980 yards"                                              
## [656] "Shooting Men's Military Rifle, 200/500/600/800/900/1,000 Yards, Team"                 
## [657] "Speed Skating Women's Team Pursuit (6 laps)"                                          
## [658] "Athletics Men's 3,200 metres Steeplechase"                                            
## [659] "Art Competitions Mixed Music, Vocals"                                                 
## [660] "Speed Skating Men's Team Pursuit (8 laps)"                                            
## [661] "Athletics Men's 1,600 metres Medley Relay"                                            
## [662] "Fencing Women's Sabre, Team"                                                          
## [663] "Athletics Men's 56-pound Weight Throw"                                                
## [664] "Athletics Men's 4,000 metres Steeplechase"                                            
## [665] "Fencing Men's epee, Masters and Amateurs, Individual"                                 
## [666] "Shooting Mixed Free Rifle, Three Positions, 300 metres"                               
## [667] "Gymnastics Men's Team All-Around, Free System"                                        
## [668] "Rowing Men's Coxed Fours, Inriggers"                                                  
## [669] "Tennis Mixed Doubles, Covered Courts"                                                 
## [670] "Shooting Men's Military Rifle, 200 metres"                                            
## [671] "Shooting Men's Military Rifle, Prone, 300 metres"                                     
## [672] "Shooting Men's Military Rifle, 200, 400, 500 and 600 metres, Team"                    
## [673] "Shooting Men's Military Rifle, Prone, 600 metres"                                     
## [674] "Shooting Men's Small-Bore Rifle, Prone, 50 metres, Team"                              
## [675] "Shooting Men's Small-Bore Rifle, Disappearing Target, 25 metres"                      
## [676] "Shooting Men's Small-Bore Rifle, Any Position, 50 metres"                             
## [677] "Shooting Men's Free Pistol, 30 metres"                                                
## [678] "Tennis Women's Singles, Covered Courts"                                               
## [679] "Shooting Men's Military Pistol, 25 metres"                                            
## [680] "Shooting Men's Muzzle-Loading Pistol, 25 metres"                                      
## [681] "Basque Pelota Men's Two-Man Teams With Cesta"                                         
## [682] "Gymnastics Men's Side Horse"                                                          
## [683] "Sailing Mixed 10 metres"                                                              
## [684] "Athletics Men's Shot Put, Both Hands"                                                 
## [685] "Athletics Men's Javelin Throw, Both Hands"                                            
## [686] "Military Ski Patrol Men's Military Ski Patrol"                                        
## [687] "Sailing Mixed 12 metres"                                                              
## [688] "Shooting Men's Running Target, Double Shot, Team"                                     
## [689] "Sailing Mixed 1-2 Ton"                                                                
## [690] "Sailing Mixed Open"                                                                   
## [691] "Archery Men's Double York Round"                                                      
## [692] "Sailing Mixed 0.5-1 Ton"                                                              
## [693] "Croquet Mixed Singles, One Ball"                                                      
## [694] "Sailing Mixed 0-0.5 Ton"                                                              
## [695] "Archery Men's Continental Style"                                                      
## [696] "Croquet Mixed Singles, Two Balls"                                                     
## [697] "Sailing Mixed 3-10 Ton"                                                               
## [698] "Croquet Mixed Doubles"                                                                
## [699] "Cycling Men's 25 kilometres"                                                          
## [700] "Sailing Mixed 2-3 Ton"                                                                
## [701] "Athletics Men's 4 mile, Team"                                                         
## [702] "Shooting Men's Small-Bore Rifle, 50 and 100 yards, Team"                              
## [703] "Athletics Men's 3 mile, Team"                                                         
## [704] "Tennis Men's Doubles, Covered Courts"                                                 
## [705] "Motorboating Mixed A-Class (Open)"                                                    
## [706] "Sailing Mixed 6.5 metres"                                                             
## [707] "Shooting Men's Trap, Single Shot, 16 metres"                                          
## [708] "Swimming Men's 200 metres Team Swimming"                                              
## [709] "Sailing Mixed 10-20 Ton"                                                              
## [710] "Sailing Mixed 20+ Ton"                                                                
## [711] "Shooting Men's Trap, Double Shot, 14 metres"                                          
## [712] "Art Competitions Mixed Literature, Dramatic Works"                                    
## [713] "Athletics Men's 200 metres Hurdles"                                                   
## [714] "Shooting Men's Dueling Pistol, 30 metres, Team"                                       
## [715] "Cricket Men's Cricket"                                                                
## [716] "Art Competitions Mixed Music, Compositions For Solo Or Chorus"                        
## [717] "Archery Women's Double National Round"                                                
## [718] "Sailing Mixed 7 metres"                                                               
## [719] "Motorboating Mixed C-Class"                                                           
## [720] "Motorboating Mixed B-Class (Under 60 Feet)"                                           
## [721] "Racquets Men's Doubles"                                                               
## [722] "Racquets Men's Singles"                                                               
## [723] "Jeu De Paume Men's Singles"                                                           
## [724] "Art Competitions Mixed Sculpturing, Reliefs"                                          
## [725] "Figure Skating Men's Special Figures"                                                 
## [726] "Shooting Men's Small-Bore Rifle, Disappearing Target, 25 metres, Team"                
## [727] "Sailing Mixed 18 foot"                                                                
## [728] "Athletics Men's 2,590 metres Steeplechase"                                            
## [729] "Wrestling Men's Unlimited Class, Greco-Roman"                                         
## [730] "Athletics Men's All-Around Championship"                                              
## [731] "Gymnastics Men's Parallel Bars, Teams"                                                
## [732] "Gymnastics Men's Horizontal Bar, Teams"                                               
## [733] "Weightlifting Men's All-Around Dumbbell Contest"                                      
## [734] "Swimming Men's 100 Yard Backstroke"                                                   
## [735] "Athletics Men's Standing Triple Jump"                                                 
## [736] "Swimming Men's 440 Yard Breaststroke"                                                 
## [737] "Rowing Men's 17-Man Naval Rowing Boats"                                               
## [738] "Rowing Men's 6-Man Naval Rowing Boats"                                                
## [739] "Swimming Men's 100 metres Freestyle For Sailors"                                      
## [740] "Swimming Men's 50 yard Freestyle"                                                     
## [741] "Swimming Men's 100 yard Freestyle"                                                    
## [742] "Gymnastics Men's Tumbling"                                                            
## [743] "Cycling Men's 1/4 mile"                                                               
## [744] "Gymnastics Men's Club Swinging"                                                       
## [745] "Archery Men's Unknown Event"                                                          
## [746] "Sailing Mixed 12 foot"                                                                
## [747] "Aeronautics Mixed Aeronautics"                                                        
## [748] "Sailing Mixed 30 metres"                                                              
## [749] "Sailing Mixed 40 metres"                                                              
## [750] "Fencing Men's Single Sticks, Individual"                                              
## [751] "Archery Men's Double American Round"                                                  
## [752] "Swimming Men's 4 x 50 Yard Freestyle Relay"                                           
## [753] "Golf Men's Team"                                                                      
## [754] "Gymnastics Men's Individual All-Around, 4 Events"                                     
## [755] "Cycling Men's 25 mile"                                                                
## [756] "Cycling Men's 5 mile"                                                                 
## [757] "Cycling Men's 1/2 mile"                                                               
## [758] "Cycling Men's 1 mile"                                                                 
## [759] "Cycling Men's 1/3 mile"                                                               
## [760] "Archery Men's Team Round"                                                             
## [761] "Cycling Men's 2 mile"                                                                 
## [762] "Roque Men's Singles"                                                                  
## [763] "Swimming Men's Plunge For Distance"                                                   
## [764] "Archery Women's Team Round"                                                           
## [765] "Archery Women's Double Columbia Round"
# Unique items

#unique(athletes_df$Team)
#Finding athletes from India

#Print the first 6 rows that have TRUE values

head(athletes_df[athletes_df$Team == "India",]) 
#All rows with team name Japan

athletes_df[athletes_df$Team == "Japan",]
#Top countries that have sent athletes to the Olympics
top10 <- athletes_df %>%
  group_by(Team) %>%
  summarise(participants = n()) %>%
  arrange(desc(participants))

#top10$Team
head(top10,10)
#Plotting the  top 10 countries and reordering  graph based on participants in descending order
ggplot(head(top10,10),aes(x = reorder(Team, -participants), y = participants, fill = Team)) +
  geom_bar(stat = "identity") +
  #scale_x_discrete(guide = guide_axis(n.dodge=13)) +
  theme_classic() +
  labs(
    x = "Team",
    y = "Participation",
    title = paste(
      "Group_by Team with summarise()"
    )
  )

# To find unique sports seasons
unique(athletes_df$Season)
## [1] "Summer" "Winter"
#Find unique sports where season is summer
#athletes_df$Season == "Summer"
summer_sport <- athletes_df[athletes_df$Season == "Summer",]
unique(summer_sport$Sport)
##  [1] "Hockey"                "Wrestling"             "Football"             
##  [4] "Athletics"             "Boxing"                "Taekwondo"            
##  [7] "Judo"                  "Weightlifting"         "Shooting"             
## [10] "Triathlon"             "Synchronized Swimming" "Sailing"              
## [13] "Swimming"              "Equestrianism"         "Fencing"              
## [16] "Cycling"               "Gymnastics"            "Rowing"               
## [19] "Handball"              "Volleyball"            "Table Tennis"         
## [22] "Trampolining"          "Badminton"             "Tennis"               
## [25] "Canoeing"              "Basketball"            "Beach Volleyball"     
## [28] "Rugby"                 "Diving"                "Rugby Sevens"         
## [31] "Water Polo"            "Polo"                  "Art Competitions"     
## [34] "Modern Pentathlon"     "Figure Skating"        "Archery"              
## [37] "Golf"                  "Softball"              "Baseball"             
## [40] "Rhythmic Gymnastics"   "Tug-Of-War"            "Ice Hockey"           
## [43] "Lacrosse"              "Basque Pelota"         "Croquet"              
## [46] "Motorboating"          "Cricket"               "Racquets"             
## [49] "Jeu De Paume"          "Alpinism"              "Aeronautics"          
## [52] "Roque"
# To find total number of males and females
gender_count <- athletes_df %>%
  group_by(Sex) %>%
  summarise(male_female = n())

gender_count
#Grouping columns and find their length
tapply(athletes_df$Sex,athletes_df$Sex,length)
##      F      M 
##  74393 196374
# Pie Chart for number of females vs males participants
piepercent <- round(100 * gender_count$male_female / sum(gender_count$male_female), 1)
pie(gender_count$male_female, labels = piepercent, main = "Pie Chart M/F", col = rainbow(length(gender_count)))
legend("topright", c("Female", "Male"), 
       cex = 0.5, fill = rainbow(length(gender_count)))

# Find total no of medals
medal <- tapply(athletes_df$Medal, athletes_df$Medal, length)
medal
## Bronze   Gold     NA Silver 
##  13291  13371 230993  13112
pie(medal)

# Total number of female athletes in Summer Olympics each year
participants <- athletes_df %>%
  group_by(Sex, Season, Year) %>%
  summarise(participants = n())
## `summarise()` has grouped output by 'Sex', 'Season'. You can override using the `.groups` argument.
head(participants,20)
female_summer <- participants[participants$Sex=='F' & participants$Season == "Summer",]
female_summer
#Plotting female participation in Summer Olympics
plot(female_summer$Year, female_summer$participation)
## Warning: Unknown or uninitialised column: `participation`.

participants[participants$Sex=='F',]
# Total number of female athletes in Winter Olympics each year
participants[participants$Sex=='F' & participants$Season == "Winter",]
# Total number of male athletes in Winter Olympics each year
male_winter <- participants[participants$Sex=='M' & participants$Season == "Winter",]
male_winter
# No of athletes with Gold medal and age more than 60
Gold_medal <- athletes_df[athletes_df$Medal == "Gold" & athletes_df$Age > 60,]
Gold_medal
count(Gold_medal)
#First and second column

athletes_df[athletes_df$Medal == "Gold" & athletes_df$Age > 60,c(1,2)]
#Display specific columns from the result

athletes_df[athletes_df$Medal == "Gold" & athletes_df$Age > 60,c(1:2,13)]
#Grouping based on gender and medal

All_gender_medal <- athletes_df %>%
  group_by(Sex, Medal) %>%
  summarise(count_medal = n())
## `summarise()` has grouped output by 'Sex'. You can override using the `.groups` argument.
All_gender_medal
#Grouping based on medals in Females only

All_gender_medal[All_gender_medal$Sex == 'F',]
#Visualization

Gold_medal
#Finding  which sport has gold medals

tbl <- with(Gold_medal, table(Medal,Sport))
tbl
##       Sport
## Medal  Archery Art Competitions Roque Shooting
##   Gold       3                1     1        1
barplot(tbl)

#Find which region has gold medals

tbl <- with(Gold_medal, table(Medal,Region))
barplot(tbl)

#Gold medals from each country

Country_gold <- athletes_df %>%
  group_by(Region, Medal) %>%
  summarise(cg_count <- n())
## `summarise()` has grouped output by 'Region'. You can override using the `.groups` argument.
#No of medals in each country

Country_gold
#No of gold medals in each country

Country_gold[Country_gold$Medal == "Gold",]
#Top 10 countries with gold medal in descending order

top10gold <- athletes_df %>%
  group_by(Region, Medal) %>%
  summarise(participants = n()) %>%
  arrange(desc(participants))
## `summarise()` has grouped output by 'Region'. You can override using the `.groups` argument.
top10gold <- head(top10gold[top10gold$Medal == "Gold",],10)
top10gold
#Plotting Top 10 countries with gold medal

ggplot(top10gold,aes(x = Region, y = participants, fill = Region)) +
  geom_bar(stat = "identity") +
  #scale_x_discrete(guide = guide_axis(n.dodge=13)) +
  theme_classic() +
  labs(
    x = "Team",
    y = "Participation",
    title = paste(
      "Group_by Team with summarise()"
    )
  )

#Rio Olympics

#Finding latest year Olympics were conducted

max(unique(athletes_df$Year))
## [1] 2016
#Finding no of gold medals for each team

team_names <- athletes_df[athletes_df$Year == 2016 & athletes_df$Medal == "Gold", 8]
tail(sort(table(team_names)),10)
## team_names
##         Japan        France     Argentina     Australia        Brazil 
##            17            20            21            23            34 
##         China       Germany        Russia Great Britain United States 
##            44            47            50            64           137
#Plotting no. of gold medals for each team

barplot(tail(sort(table(team_names)),10))

#Plotting after adjusting the graphical margins

par(mai=c(1,2,1,1)) 
barplot(tail(sort(table(team_names)),10), main = "Gold Medal Rio Olympics",
        xlab = "No. of Gold Medals",
        col = c(rainbow(10)),
        horiz = TRUE, las = 1)

unique(team_names)
##  [1] "Argentina"                   "Armenia"                    
##  [3] "Australia"                   "Azerbaijan"                 
##  [5] "Bahamas"                     "Belgium"                    
##  [7] "Belarus"                     "Brazil"                     
##  [9] "Brazil-1"                    "Bahrain"                    
## [11] "Canada"                      "China"                      
## [13] "China-1"                     "Cote d'Ivoire"              
## [15] "Colombia"                    "Croatia"                    
## [17] "Cuba"                        "Czech Republic"             
## [19] "Denmark"                     "Spain-2"                    
## [21] "Spain"                       "Ethiopia"                   
## [23] "Fiji"                        "France"                     
## [25] "Great Britain"               "Georgia"                    
## [27] "Germany"                     "Germany-1"                  
## [29] "Greece"                      "Hungary"                    
## [31] "Indonesia-1"                 "Individual Olympic Athletes"
## [33] "Iran"                        "Italy"                      
## [35] "Jamaica"                     "Jordan"                     
## [37] "Japan"                       "Kazakhstan"                 
## [39] "Kenya"                       "South Korea"                
## [41] "Kosovo"                      "Netherlands"                
## [43] "New Zealand"                 "Poland"                     
## [45] "North Korea"                 "Puerto Rico"                
## [47] "Romania"                     "South Africa"               
## [49] "Russia"                      "Russia-2"                   
## [51] "Slovenia"                    "Serbia"                     
## [53] "Switzerland"                 "Slovakia"                   
## [55] "Sweden"                      "Thailand"                   
## [57] "Tajikistan"                  "Chinese Taipei"             
## [59] "Turkey"                      "Ukraine"                    
## [61] "United States"               "United States-2"            
## [63] "Uzbekistan"                  "Vietnam"
#Group based on Height and weight of medal winners

winners_ht_wt <- athletes_df %>%
  group_by(Medal != "NA")
#OR
winners <- athletes_df[athletes_df$Medal != "NA",]
winners
#Plotting height and weight of all medal winners

plot(winners[,6], winners[,7])

#Height and weight of only female participants

plot(winners[winners$Sex == 'F',6], winners[winners$Sex == 'F',7], xlim = c(120,220), ylim = c(30,180), col = "green")

#Height and weight of only male participants

plot(winners[winners$Sex == 'M',6], winners[winners$Sex == 'M',7], xlim = c(120,220), ylim = c(30,180), col = "blue", xlab = "Height", ylab = "Weight")

#Height and weight of male and female participants

plot(winners[winners$Sex == 'M',6], winners[winners$Sex == 'M',7], xlim = c(120,220), ylim = c(30,180), col = "blue", xlab = "Height", ylab = "Weight")
points(winners[winners$Sex == 'F',6], winners[winners$Sex == 'F',7], xlim = c(120,220), ylim = c(30,180), col = "red")
#Adding legend function
legend(120, 190, legend = c("Male", "Female"),col=c("blue", "red"), cex=0.8, pch = c(19,19))